package com.kfm.base.thread.day01;

public class Demo09 {

    public static void main(String[] args) {
        Runnable r = () -> {
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName()  + " : " +i);
            }
        };
        Thread t1 = new Thread(r, "A");
        Thread t2 = new Thread(r, "B");

        t1.setPriority(8);
        t2.setPriority(10);

        t1.start();
        t2.start();

        Thread.yield(); // 让步
//        Thread.yield(); // 让步

        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName() + " : " + i);
        }



    }
}
